import Vue from 'vue'
import Router from 'vue-router'

const Home = () => import('../views/home/Home.vue')
const Order = () => import('../views/order/Order.vue')
const Search = () => import('../views/search/Search.vue')
const Profile = () => import('../views/profile/Profile.vue')


Vue.use(Router)

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const originalReplace = Router.prototype.replace;
Router.prototype.replace = function replace(location) {
  return originalReplace.call(this, location).catch(err => err);
};

const routes = [{
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
  },
  {
    path: '/order',
    component: Order,
  },
  {
    path: '/search',
    component: Search,
  },
  {
    path: '/profile',
    component: Profile
  },
];
const router = new Router({
  routes,
  mode: 'hash'
})
export default router